# -*- encoding=utf8 -*-
__author__ = "Administrator"

from airtest.core.api import *

auto_setup(__file__)

def gban():
    gb = exists(Template(r"tpl1564891748169.png", record_pos=(0.456, -0.228), resolution=(960, 540)))
    if gb:
        touch(gb)
        sleep(1)
def xmfl():
    ll = wait(Template(r"tpl1564898366093.png", record_pos=(-0.463, 0.234), resolution=(960, 540)))
    if ll:
        touch(ll)
        xm = wait(Template(r"tpl1564898432505.png", record_pos=(0.409, 0.236), resolution=(960, 540)))
        if xm:
            touch(xm)
            l = wait(Template(r"tpl1564898470132.png", record_pos=(-0.147, 0.183), resolution=(960, 540)))
            if l:
                touch(l)
    gban()




def gj():
    while True:
        ll = exists(Template(r"tpl1564750469186.png", record_pos=(-0.304, 0.159), resolution=(960, 540)))
        if ll:
            touch(ll)
        ll=  exists(Template(r"tpl1564754469527.png", record_pos=(0.404, -0.268), resolution=(960, 540)))
        if ll:
            touch(ll)
        ll = exists(Template(r"tpl1564755490448.png", record_pos=(0.464, 0.02), resolution=(960, 540)))
        if ll:
            touch(ll)
        sleep(3.0)

def um():
    ll = exists(Template(r"tpl1564755241048.png", record_pos=(0.469, -0.179), resolution=(960, 540)))
    if ll:
        touch(ll)
    else:
        touch(Template(r"tpl1564755311357.png", record_pos=(-0.464, 0.239), resolution=(960, 540)))
        sleep(1)
    ll = exists(Template(r"tpl1564755241048.png", record_pos=(0.469, -0.179), resolution=(960, 540)))
    
    if ll:
        touch(ll)
    
    ll = exists(Template(r"tpl1564756658646.png", record_pos=(0.418, -0.09), resolution=(960, 540)))
    if ll:
        touch(ll)
        
        
        
def isEndRc():
    
    gban()
    ll = exists(Template(r"tpl1564887214187.png", record_pos=(0.411, -0.174), resolution=(960, 540)))
    if ll:
        touch(ll)
        wc = exists(Template(r"tpl1564888940809.png", record_pos=(-0.41, 0.036), resolution=(960, 540)))
        if wc:
            gban()
            sleep(60)
            isEndRc()
        else: return
    else:
            
        sleep(30)
        isEndRc()
    gban()

        
def rc(time = 10):
    ll = exists(Template(r"tpl1564887214187.png", record_pos=(0.411, -0.174), resolution=(960, 540)))
    if ll:
        touch(ll)
        sleep(2)
        qw = exists(Template(r"tpl1564887588652.png", record_pos=(-0.11, -0.127), resolution=(960, 540)))

        if qw:
            touch(qw)
            sleep(60*time)
    isEndRc()
                

def ks():
    tt = exists(Template(r"tpl1564889338538.png", record_pos=(0.002, -0.52), resolution=(540, 960)))
    if tt:
        touch(tt)
        sleep(60)
        dl = exists(Template(r"tpl1564889653704.png", record_pos=(0.0, 0.049), resolution=(960, 540)))
        touch(dl)
        sleep(20)

def fb_dk():
    gban()
    fb= exists(Template(r"tpl1564890364683.png", record_pos=(0.471, -0.177), resolution=(960, 540)))
    if fb:
        touch(fb)
        sleep(1)
def fb_xlhj_js(time = 1):
    ks = exists(Template(r"tpl1564890645890.png", record_pos=(0.298, 0.204), resolution=(960, 540)))
    if ks:
        touch(ks)
        sleep(10)
        hz = exists(Template(r"tpl1564890645890.png", record_pos=(0.298, 0.204), resolution=(960, 540)))
        if hz:
            gban()
        else:
            sleep(60*time)
            fb_xlhj_js()


def fb_xlhj(time = 7):
    fb_dk()
    hj = exists(Template(r"tpl1564890501962.png", record_pos=(-0.294, -0.188), resolution=(960, 540)))
    if hj:
        touch(hj)
        sleep(1)
        ks = exists(Template(r"tpl1564890645890.png", record_pos=(0.298, 0.204), resolution=(960, 540)))
        if ks:
            touch(ks)
    fb_xlhj_js(time)

    
def fb_tdbk(time = 3):
    fb_dk()
    bk= exists(Template(r"tpl1564894434122.png", record_pos=(-0.195, -0.188), resolution=(960, 540)))
    if bk:
        touch(bk)
        sleep(1)
        ks = exists(Template(r"tpl1564890645890.png", record_pos=(0.298, 0.204), resolution=(960, 540)))
        if ks:
            touch(ks)
        
    fb_xlhj_js(time)

def fb_fsd(time = 3):
    fb_dk()
    d = exists(Template(r"tpl1564895430108.png", record_pos=(-0.092, -0.188), resolution=(960, 540)))
    if d:
        touch(d)
        sleep(1)
        ks = exists(Template(r"tpl1564890645890.png", record_pos=(0.298, 0.204), resolution=(960, 540)))
        if ks:
            touch(ks)
    fb_xlhj_js(time)   
def qbrw():
    fb_xlhj()
    fb_tdbk()
    fb_fsd()
    

def kfhd():
    ll = exists(Template(r"tpl1564755607017.png", record_pos=(0.171, -0.256), resolution=(960, 540)))
    if ll:
        touch(ll)
    sleep(1)
    ll = exists(Template(r"tpl1564755779757.png", record_pos=(0.17, -0.186), resolution=(960, 540)))
    if ll:
        touch(ll)
        sleep(1)
    ll= exists(Template(r"tpl1564755870359.png", record_pos=(0.324, -0.09), resolution=(960, 540)))
    if ll:
        touch(ll)
qbrw()


    
    
    

    


    
